/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sumas;

import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.midlet.*;


/**
 * @author Owner
 */
public class sumandocanvas extends GameCanvas implements CommandListener, Runnable {

    /**
     * constructor
     */
    Thread h;
    Graphics g;
    String texto ="SUMADOR";
    Command exit;
    //sumando sumi = new sumando();
    public sumandocanvas() {
        super(true);
        g=getGraphics();
        exit = new Command("Exit", Command.EXIT, 1);
        try {
            // Set up this canvas to listen to command events
            setCommandListener(this);
            // Add the Exit command
            addCommand(new Command("Exit", Command.EXIT, 1));
        } catch (Exception e) {
            e.printStackTrace();
        }
        h= new Thread(this);
        h.start();
    }

    /**
     * paint
     */
    public void run(){
    }
    
    public void paint(Graphics g) {
        //Establecer color verde oscuro
g.setColor(0,40,0);
//Dibujar un rectángulo relleno en toda la pantalla
g.fillRect(0, 0, getWidth(), getHeight());
//Establecer color verde
g.setColor(0,255,0);
//Escribir el texto de ejemplo en la posición 0,0
g.drawString(texto,100,5,Graphics.TOP|Graphics.LEFT);
    }

    /**
     * Called when a key is pressed.
     */
    protected void keyPressed(int keyCode) {
    }

    /**
     * Called when a key is released.
     */
    protected void keyReleased(int keyCode) {
    }

    /**
     * Called when a key is repeated (held down).
     */
    protected void keyRepeated(int keyCode) {
    }

    /**
     * Called when the pointer is dragged.
     */
    protected void pointerDragged(int x, int y) {
    }

    /**
     * Called when the pointer is pressed.
     */
    protected void pointerPressed(int x, int y) {
    }

    /**
     * Called when the pointer is released.
     */
    protected void pointerReleased(int x, int y) {
    }

    /**
     * Called when action should be handled
     */
    public void commandAction(Command command, Displayable displayable) {
        if(command.getCommandType() == Command.EXIT) {
        texto = "hpdadaf";
        repaint();
        //sumi.destroyApp(true);
        
        //notifyDestroyed();
  }
    }

    /**
     *
     * @param unconditional
     */
    public void destroyApp(boolean unconditional) {
    }

    private void notifyDestroyed() {
        throw new UnsupportedOperationException("Not yet implemented");
    }
}
